package wang.aweb.childcar.model.dao;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import wang.aweb.childcar.model.pojo.Device;
import wang.aweb.childcar.model.query.DeviceParam;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Repository
public interface DeviceMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Device record);

    int insertSelective(Device record);

    Device selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Device record);

    int updateByPrimaryKey(Device record);

    List<Device> selectList(@Param("query") DeviceParam query);

    Device findByName(String name);
    Device findByImei(String imei);

    List<Device> selectAll();

    List<Device> selectByFenceId(Integer id);

    List<Device> selectByAgentId(Integer id);

    Integer getCount(@Param("query") Map<String, Integer> query);

    Integer getAgentDeviceCount(@Param("agentId") Integer agentId, @Param("starttime") Date starttime, @Param("endtime") Date endtime);
}